<template>
  <el-dialog :title="title" :visible.sync="showDialog" top="0" :close-on-click-modal="false" @close="cancel">
    <div class="equ-list">
      <el-descriptions :column="2" border>
        <el-descriptions-item v-for="(item, index) in list" :key="index">
          <template slot="label">
            {{ item.equipmentTypeName }}
          </template>
          {{ item.equipmentName }}
        </el-descriptions-item>
      </el-descriptions>
      <span v-if="list.length === 0">暂无设备</span>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" class="savebtn" @click="cancel()">关 闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    value: Boolean,
    list: {
      type: Array,
      default: () => {
        return [];
      }
    },
    title: {
      type: String,
      default: '设备'
    }
  },
  data() {
    return {
      showDialog: false
    };
  },
  watch: {
    value(v) {
      this.showDialog = v;
    }
  },
  mounted() {},
  methods: {
    close() {
      this.$emit('input', false);
    },
    cancel() {
      this.$emit('input', false);
    }
  }
};
</script>

<style lang="scss" scoped>
::v-deep {
  .el-descriptions .is-bordered .el-descriptions-item__cell {
    border-color: #000;
    color: #000;
  }
  .el-descriptions-item__label {
    font-weight: bold !important;
  }
}
</style>
